<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WebSocket Example</title>
</head>
<body>
    <script>
        // 打开一个WebSocket:
        var ws = new WebSocket('ws://localhost:3000/');
        ws.onopen = function(msg) {
            ws.send('test open open front end test Hello!'); 
        }
        // 响应onmessage事件:
        ws.onmessage = function(msg) { 
            console.log('onmessage', msg); 
            // ws.send('front end test Hello!'); 
        };
        // 给服务器发送一个字符串:
        // ws.send('Hello!'); 
    </script>
</body>
</html>
